<?php

namespace App\Http\Controllers\Home;

use App\Http\Model\Articel;
use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;
use App\Http\Model\Navs;
use Illuminate\Support\Facades\View;

class CommonController extends Controller
{
    public function __construct()
    {
        //点击量排行的5篇文章
        $pics=Articel::orderBy('art_view','desc')->take(5)->get();
        //最新发布文章8篇
        $new=Articel::orderBy('art_time','desc')->take(8)->get();

        $navs=Navs::orderBy('navs_id','asc')->get();
        View::share('navs',$navs);
        View::share('pics',$pics);
        View::share('new',$new);
    }
}
